<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>开放平台管理系统</title>
    <link rel="stylesheet" href="/ssm2202/webjars/layui/2.7.6/css/layui.css">
    <script src="/ssm2202/webjars/layui/2.7.6/layui.js"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">开放平台管理系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="/ssm2202/user/pic" class="layui-nav-img">
                    <span id="username"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">Your Profile</a></dd>
                    <dd><a href="">Settings</a></dd>
                    <dd><a href="/ssm2202/logout">退出登录</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="leftMenu">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">权限管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" value="">菜单管理</a></dd>
                        <dd><a href="javascript:;">角色管理</a></dd>
                        <dd><a href="javascript:;" value="UserManagementModule/userinfo.html">用户管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" value="">客户管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" value="">应用管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" value="RoutingManagementModule/routing.html">路由管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" value="ApiSystemParamter/api_systemparamter.html">系统参数管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" value="">token管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" value="">充值管理</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" value="">日志搜索</a>
                </li>
            </ul>
        </div>
    </div>

    <div id="mainContent" class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">内容主体区域。记得修改 layui.css 和 js 的路径</div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        底部固定区域
    </div>
</div>
<script>
    var element = layui.element,
        layer = layui.layer,
        util = layui.util,
        $ = layui.$;
    $(
        function () {
            $.ajax(
                {
                    url: "/ssm2202/user/currentUser",
                    type: "get",
                    processData: false,
                    contentType: false,
                    success: function (resp) {
                        if (resp.code == 1) {
                            $("#username").text(resp.data);
                        } else {
                            console.log(resp);
                            layer.alert(resp.message, {
                                title: '提示信息'
                            });
                        }

                    },
                    error: function (result) {
                        layer.alert(result.message, {
                            title: '提示信息'
                        });
                    }
                }
            );
        }
    );
    //JS
    layui.use(function () {
        //头部事件
        util.event('lay-header-event', {
            //左侧菜单事件
            menuLeft: function (othis) {
                layer.msg('展开左侧菜单的操作', {icon: 0});
            }
            , menuRight: function () {
                layer.open({
                    type: 1
                    , content: '<div style="padding: 15px;">处理右侧面板的操作</div>'
                    , area: ['260px', '100%']
                    , offset: 'rt' //右上角
                    , anim: 5
                    , shadeClose: true
                });
            }
        });

        //监听导航点击
        element.on('nav(leftMenu)', function (elem) {
            //console.log(elem)
            // layer.msg(elem.text());
            layer.msg(elem.attr("value"));
            $("#mainContent").load(elem.attr("value"));
        });

    });
</script>
</body>
</html>
